<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>炸弹</title>
</head>
<body>
<img id="image" src="../img/banner_1.jpg" width="100%">
<b>
    <p align="center" id="pp">00:00:0<span id="time">5</span></p>
</b>



</body>
</html>
<script>
    //3. 倒计时炸弹：用定时器实现5秒倒计时，到点儿后换一张图片
    var second=5;
    var time = document.getElementById("time");
    var image = document.getElementById("image");
    function f() {
        second--;
        if (second==0){
            clearInterval(interval)
            document.getElementById("pp").innerHTML="";//清空内容

            //location.href="../img/banner_2.jpg";
            image.src="../img/banner_2.jpg"//更换图片


        }
        time.innerHTML=second+"";
    }
    var interval = setInterval(f,1000);
</script>
